package com.estock.platform.http.response;

import com.estock.platform.http.utils.RequestUtil;


/**
 * @author richard
 *
 */
public class ResponseFactory {

    @SuppressWarnings("unchecked")
	public static <T extends JSONResponse> T createCustomResponse(String body, String contentType,
                                                                         int responseCode,
                                                                         Class<T> clazz)
        throws Exception {

    	JSONResponse resp = (JSONResponse) RequestUtil
            .instantiateClassWithParameters(clazz, null, null);

        resp.init(body, contentType, responseCode);

        return (T) resp;
    }


}
